﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SavageWorldsCharactersTool {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        public int agility = 4;
        public int smarts = 4;
        public int spirit = 4;
        public int strength = 4;
        public int vigor = 4;
        string img_dir = "../../";

        /*private void agilityField_ValueChanged(object sender, EventArgs e) {
            NumericUpDown field = (NumericUpDown)sender;
            if (atribute_points_field.Value > 1) {
                if (field.Value < 4) {
                    field.Value = 4;
                } else if (agilityField.Value > 12) {
                    field.Value = 12;
                } else {
                    atribute_points_field.Value--;
                }
            }
        }

        private void numericUpDown3_Scroll(object sender, ScrollEventArgs e) {
            MessageBox.Show(Convert.ToString(e.OldValue));


        }*/

        /*private void agilityField_Scroll(Object sender, ScrollEventArgs e) {

            System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
            messageBoxCS.AppendFormat("{0} = {1}", "ScrollOrientation", e.ScrollOrientation);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "Type", e.Type);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "NewValue", e.NewValue);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "OldValue", e.OldValue);
            messageBoxCS.AppendLine();
            MessageBox.Show(messageBoxCS.ToString(), "Scroll Event");
        }*/

        private void attribute_minus_Click(object sender, EventArgs e) {
            Label label = (Label)sender;
            int stat = 0;
            int change = 0;
            PictureBox dice_image;
           // stat = this.agility;
           // change = +1;
           // dice_image = this.agility_dice;
           // string filename = "";

            if (label.Name == "agility_minus") {
                stat = this.agility;
                change = -1;
                dice_image = this.agility_dice;
            } else if (label.Name == "agility_plus") {
                stat = this.agility;
                change = +1;
                dice_image = this.agility_dice;
            } else {
                stat = this.agility;
                change = -1;
                dice_image = this.agility_dice;
            }

            stat += 2 * change;

            if (stat < 4) {
                stat = 4;
            } else if (stat > 12) {
                stat = 12;
            }
            dice_image.Image = new Bitmap(img_dir + "imgs/d" + Convert.ToString(stat) + ".png");

        }


        /* private void agilityField_Scroll(object sender, ScrollEventArgs e)
         {

         }*/
    }
}
